package com.yanqu.road.server.cmd.orewar;

import com.yanqu.road.entity.player.UserBaseInfo;
import com.yanqu.road.server.cmd.CrossUnionCommand;
import com.yanqu.road.utils.YanQuMessageUtils;
import com.yanqu.road.pb.orewar.OreWarProto;
import com.yanqu.road.server.cmd.CrossCommand;
import com.yanqu.road.server.command.Cmd;
import com.yanqu.road.server.logic.MessageHelper;
import com.yanqu.road.server.manager.orewar.CrossOreWarMgr;
import com.yanqu.road.message.YanQuMessage;
import com.yanqu.road.server.protocol.Protocol;


@Cmd(code = Protocol.C_CROSS_OREWAR_GET_REWARD, desc = "领取奖励")
public class CrossGetRewardCmd extends CrossUnionCommand {

    private long userId;
    private int activityId;
    private UserBaseInfo userBaseInfo;

    @Override
    public boolean parseData(YanQuMessage packet) throws Exception {
        OreWarProto.CrossOreGetRewardReqMsg reqMsg = OreWarProto.CrossOreGetRewardReqMsg.parseFrom(packet.getBytes());
        userId = packet.getPlayerId();
        activityId = reqMsg.getActivityId();
//        userBaseInfo = PlayerBasePb.parseToUserBaseInfo(reqMsg.getPlayerBaseData());
        return true;
    }

    @Override
    public void execute(YanQuMessage packet) throws Exception {
        OreWarProto.CrossOreGetRewardRespMsg.Builder respMsg = CrossOreWarMgr.getSelfOccupyReward(activityId,userId,groupId);
        YanQuMessage pbMsg = YanQuMessageUtils.buildMessage(Protocol.S_CROSS_ORE_WAR_GET_REWARD, respMsg);
        MessageHelper.sendPacket(serverId, userId, pbMsg);
    }

    @Override
    public void sendData() {

    }

}
